import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//导入vant.js文件执行，从而注册组件
import './plugin/vant.js'
// 导入global.css全局样式
import './assets/css/global.css'
//导入axios
import axios from 'axios'

axios.defaults.baseURL = 'http://www.liulongbin.top:3005'

Vue.config.productionTip = false
//将axios添加到Vue的原型中，将来我们就可以通过this.$http来访问axios并发送请求了
Vue.prototype.$http = axios

Vue.filter('dateFormat', function (time) {
  const dt = new Date(time)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${y}-${m}-${d}`
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
